<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>{$page_title}</title>
       <script type="text/javascript" language="javascript" src="{lib file=jquery-1.6.3.min.js}"></script>
       <script language="javascript" type="text/javascript" src="{lib file=jquery.ui/jquery.ui.js}"></script>

        <script language="javascript" type="text/javascript" src="{res file=js/fabric_info.js}"></script>
        <script language="javascript" type="text/javascript" src="{lib file=jquery.plugins/jquery.validate.js}"></script>
        <script language="javascript" type="text/javascript" src="{res file=js/common.js}"></script>
        <script language="javascript" type="text/javascript" src="{res file=DatePicker/WdatePicker.js}"></script>
        <script language="javascript" type="text/javascript" src="{lib file=ajaxfileupload.js}"></script>
        <script language="javascript" type="text/javascript" src="{res file=js/jquery.funkyUI.js}"></script>
        <script language="JavaScript" type="text/javascript" src="{res file=js/lan.js}"></script>
        <link href="template/style/css/style.css" type="text/css" rel="stylesheet" />
        <script language="javascript" type="text/javascript" src="{res file=js/select.js}"></script>

        <style type="text/css">
.btn-2{margin-bottom:5px;}
.table_no_border,.table_no_border td,.table_no_border th{
	padding:0;
	margin:0;
	border-bottom:none;
	border-top:none;
	}
.fabric_info_list td input,.fabric_info_list td select{width:93%;}
.fabric_info_table td{
	border-left:none;
	border-bottom:none;
	padding:2px;
	}
.fabric_info_table th
{
   border-top:none;
}
.no_left_border
{
	border-left:none;
}
.no_right_border
{
	border-right:none;
}
.fabric_info_table .btn-2{
	line-height:20px;
	height:20px;
	margin-bottom:1px;}
</style>
    </head>
<body>
<script type="text/javascript">
$(function() {
	
	$('select[select_input="select_input"]').each(function(i) {
		init_select_input($(this));
	});
	$('div.select-input').each(function(i) {
		$(this).css('z-index', $('div.select-input').length - i);
	});
	
	$('input.btn-2[value="移除"]').click(function() {
		remove_fabric_shop($(this));
	});
	
	$('input[acttype="confirm"]').click(function() {
		if (confirm('是否已经保存信息？更新样板信息之后将会使已确认样板状态无效。\r\n\r\n是否继续？')) {
			$.getJSON('index.php?app=sample&act=confirm&id={$smarty.get.id}', function(json) {
				alert(json.msg);
			});
		}
	});
	

});

function sort_new_fabric_info()
{
	$('input[name^="new_fabric_info"][name$="[description]"]').each(function(i) {
		$(this).attr('name', 'new_fabric_info[' + i + '][description]');
	});
	$('input[name^="new_fabric_info"][name$="[fabric_shop_id]"]').each(function(i) {
		$(this).attr('name', 'new_fabric_info[' + i + '][fabric_shop_id]');
		$(this).attr('id', 'new_fabric_info[' + i + '][fabric_shop_id]');
	});
}

function remove_fabric_shop(_this)
{
	if (!confirm('确定要移除该信息吗？')) {
		return;
	}
	$(_this).parent().parent().remove();
}

function change_pic(id){
	$.funkyUI({url:"index.php?app=comupload&act=order_pics&id="+id,css:{width:"350",height:"250"}});
	return false;
}

function calculate(_this){
	var total = 0;
	$(_this).parent().parent().children().children().each(function(i,n){
		var obj = $(n);
		if(i>1&&i<8){
		 total = total*1+obj.val()*1;
		}else if(i==8){
			obj.val(total);
		}
	});
}

function change_size(_this){
	var code = new Number($(_this).parent().parent().children(":nth-child(8)").children(":only-child").val());
	var a = $(_this).parent().parent().children().children();
	var b;
	var c;
	a.each(function(i,n){
		if(i>0&&i<7){
			var obj = $(n);
			if(obj.attr("name")==$(_this).attr("name")){
				b = new Number(i);
				c = new Number($(_this).val());
			}
		}
		if($(_this).attr("name")=="code[]"){
			b = new Number(1);
			c = new Number($(_this).parent().parent().children(":nth-child(2)").children(":only-child").val());
		}
	});
	a.each(function(i,n){
		var obj = $(n);
		if(i>0&&i<7){
			obj.val(Math.round((c+(i-b)*code)*100)/100);
		}
	});
}

  function remove_style_size(_this)
  {
	  if (!confirm('确定要移除该信息吗')) {
		  return;
	  }
	  $(_this).parent().parent().remove();
  }
  function add_style_size()
  {

	  var newTr = $('#one_size').clone(true);
	  newTr.css("display","");
	  $('#one_size').parent().parent().find("tr:last").after(newTr);
  }
</script>
<div class="sub-body">
	<h3 class="title-1 tab-frame">制单信息</h3>
    <div class="tab-frame" style="width:900px;">
		<form method="post">
		<table align="left" cellpadding="0" cellspacing="0" class="tab-add">
        	<tr>
            	<th width="20%" class="align_right">下单日期：</th>
            	<td width="30%" class="td_align_1" colspan="3">{$order.order_create_date|date}&nbsp;&nbsp;订单状态：{$lang.order_status.$order.status}&nbsp;&nbsp;&nbsp;&nbsp;制单状态：{$lang.ss_status.$ss_info.ss_status}</td>
            	<th colspan="2" width="300">正面</th>
            	<th colspan="2" width="300">反面</th>
            </tr>
        	<tr>
            	<th class="align_right">品&nbsp;&nbsp;&nbsp;&nbsp;牌：</th>
            	<td class="td_align_1" colspan="3">{$order.brand_name}</td>
            	<td colspan="2" rowspan="10" style="text-align:center;"><img id="front_image" width="220" height="264" src="{$order.front_pic}" alt=""></td>
            	<td colspan="2" rowspan="10" style="text-align:center;"><img id="back_image" width="220" height="264" src="{$order.back_pic}" alt=""></td>
            </tr>
        	<tr>
            	<th class="align_right">跟&nbsp;&nbsp;&nbsp;&nbsp;单：</th>
            	<td class="td_align_1" colspan="3">{$order.merchandiser}</td>
            </tr>
        	<tr>
            	<th class="align_right">订&nbsp;单&nbsp;号：</th>
            	<td class="td_align_1" colspan="3"><a style="color:blue" href="{url app=order&act=edit&id=$order.order_id}">{$order.order_sn|escape}</a> </td>
            </tr>
        	<tr>
            	<th class="align_right">款&nbsp;&nbsp;&nbsp;&nbsp;号：</th>
            	<td class="td_align_1" colspan="3">{$order.style_sn|escape}</td>
            </tr>
        	<tr>
            	<th class="align_right">参考板号：</th>
            	<td class="td_align_1" colspan="3">{$order.sample_sn}</td>
            </tr>
        	<tr>
            	<th class="align_right">到板日期：</th>
            	<td class="td_align_1" colspan="3">{$order.arrival_date|date}</td>
            </tr>
        	<tr>
            	<th class="align_right">款&nbsp;&nbsp;&nbsp;&nbsp;式：</th>
            	<td class="td_align_1" colspan="3">{$order.style_name}</td>
            </tr>
        	<tr>
            	<th class="align_right">工&nbsp;&nbsp;&nbsp;&nbsp;厂：</th>
            	<td class="td_align_1" colspan="3">{$order.factory_name}</td>
            </tr>
        	<tr>
            	<th class="align_right">运&nbsp;&nbsp;&nbsp;&nbsp;输：</th>
            	<td class="td_align_1" colspan="3">{if $order.trans_type == 1}空运{else}海运{/if}</td>
            </tr>
        	<tr>
            	<th class="align_right">件&nbsp;&nbsp;&nbsp;&nbsp;数：</th>
            	<td class="td_align_1" colspan="3">{$order.quantity}</td>
            	
            </tr>
        	<tr>
            	<th class="align_right">工厂价格：</th>
            	<td class="td_align_1" colspan="3">{$order.factory_price}</td>
           		<td colspan="4" style="text-align:center;"><!--{if !$order.confirm_date && $order.status != 5}--><input id="front_pic" type="hidden" name="info[front_pic]" value="{$order.front_pic}"><input id="back_pic" type="hidden" name="info[back_pic]" value="{$order.back_pic}"><input type="button" onclick="change_pic('{$order.order_id}');" class="btn-3" value="更新图片"><!--{/if}--></td>
            </tr>
            
           
        	<tr>
            	<th class="align_right">工厂入仓日期：</th>
            	<td class="td_align_1" colspan="3">{$order.release_date|date}</td>
            	
            	<td colspan="4"></td>
            </tr>
        
            <tr>
            	<th class="align_right">PGR：</th>
            	<td colspan="3" class="td_align_1" ><input type="text" class="input-5" name="PGR" id="PGR" value="{$ss_info.PGR}" /></td>
                <th class="align_right">SGR：</th>
            	<td colspan="3" class="td_align_1"><input type="text" class="input-5" name="SGR" id="SGR" value="{$ss_info.SGR}"/></td>
            </tr>
            <tr>
                <th class="align_right">ITEM GROUP：</th>
            	<td colspan="3" class="td_align_1"><input type="text" class="input-1" name="ITEM_GROUP" id="ITEM_GROUP" value="{$ss_info.ITEM_GROUP}" /></td>
            	<th class="align_right">SEASON：</th>
            	<td colspan="3" class="td_align_1" ><input type="text" class="input-1" name="SEASON" id="SEASON" value="{$ss_info.SEASON}" /></td>
            </tr>
			<tr>
            <th class="align_right" colspan="1">颜色/数量:</th>
				<td colspan="7" class="tab-align-l">
					<table align="left" cellpadding="0" cellspacing="0" class="tab-add" width="500">
		           <th width="">颜色</th>
			       <th width="15%">包装配比</th>
			       <th width="7%">6</th>
			       <th width="7%">8</th>
			       <th width="7%">10</th>
			       <th width="7%">12</th>
			       <th width="7%">14</th>
			       <th width="7%">16</th>
			       <th width="7%">合计</th>
			       <th width="7%">操作</th>
			      <!--{foreach from=$cq_info item=c name=n}-->
			       <tr>
			       <td><input value="{$c.color}" type="text" name="color[]" class="input-8" /></td>
			       <td><input value="{$c.proportion}" type="text" name="proportion[]" class="input-8" /></td>
			       <td><input value="{$c.v6}" type="text" onblur="javascript:calculate(this);" name="v6[]" class="input-8" /></td>
			       <td><input value="{$c.v8}" type="text" onblur="javascript:calculate(this);" name="v8[]" class="input-8" /></td>
			       <td><input value="{$c.v10}" type="text" onblur="javascript:calculate(this);" name="v10[]" class="input-8" /></td>
			       <td><input value="{$c.v12}" type="text" onblur="javascript:calculate(this);" name="v12[]" class="input-8" /></td>
			       <td><input value="{$c.v14}" type="text" onblur="javascript:calculate(this);" name="v14[]" class="input-8" /></td>
			       <td><input value="{$c.v16}" type="text" onblur="javascript:calculate(this);" id="text" name="v16[]" class="input-8" /></td>
			       <td><input value="{$c.total}" type="text" name="total[]" class="input-8" readonly/></td>
			       <td><input class="btn-2" type="button" onclick="remove_fabric_shop(this);" value="移除" item="op"></td>
			       </tr>
			      <!--{/foreach}-->
			      <tr>
			       <td><input value="" type="text" name="color[]" class="input-8" /></td>
			       <td><input value="" type="text" name="proportion[]" class="input-8" /></td>
			       <td><input value="" type="text" onblur="javascript:calculate(this);" name="v6[]" class="input-8" /></td>
			       <td><input value="" type="text" onblur="javascript:calculate(this);" name="v8[]" class="input-8" /></td>
			       <td><input value="" type="text" onblur="javascript:calculate(this);" name="v10[]" class="input-8" /></td>
			       <td><input value="" type="text" onblur="javascript:calculate(this);" name="v12[]" class="input-8" /></td>
			       <td><input value="" type="text" onblur="javascript:calculate(this);" name="v14[]" class="input-8" /></td>
			       <td><input value="" type="text" onblur="javascript:calculate(this);" id="text" name="v16[]" class="input-8" /></td>
			       <td><input value="" type="text" name="total[]" class="input-8" readonly/></td>
			       <td><input type="button" item="op" class="btn-2" value="添加"  /></td>
			       </tr>
		            </table>
	            </td>
            </tr>
          <tr>
         <th class="align_right" colspan="1">配色要求</th>   
            <td colspan="7" align="left">
            <textarea style="width:90%; height:40px;" id="color_requir" name="color_requir"></textarea>
            </td>
            </tr>
            <tr>
        <th class="align_right" colspan="1">面料信息：<br /><a target="_blank" href="{url app=colorcard&act=index}">(色卡库管理)</a></th>
       <td colspan="7">
       <table width="100%" class="fabric_info_table" cellpadding="0" cellspacing="0">
       <th width="15%" class="no_left_border">面料描述</th>
       <th width="28%">{$lang.fabric_shop_name}</th>
       <th width="10%">品名/货号</th>
       <th width="8%" >价格</th>
       <th width="8%" >幅宽</th>
       <th width="20%">面料特征</th>
       <th width="5%">色卡</th>
       <th class="no_right_border">操作</th>
       <tr class="fabric_info_list">
       <td class="tab-align-l">
       <input name="fabric_info_id[]" type="hidden" value="" />
        <input name="cc_id[]" item="cc_id" type="hidden" value="" />
       <input name="description[]" item="description" type="text"  /></td>
       <td class="tab-align-l">
       <select style="width:100%; height:20px;"  name="fabric_shop_name[]" item="fabric_shop_name" data-placeholder="请选择" class="chzn-select">
       <option value="0" >未选择</option>
      <!--{foreach from=$fabric_shop_list item=fab_shop_info name=fs}-->
		<option value="{$fab_shop_info.fabric_shop_id}"  >{$fab_shop_info.fabric_shop_name}</option>
       <!--{/foreach}-->
       </select>
       </td>    
       <td class="tab-align-l"><select style="width:80px; height:20px;" name="item[]"  item="item" data-placeholder="未选择" >
        <option value="0" >未选择</option>
       </select></td>
       <td class="tab-align-l" style="padding:0;"><input readonly name="price[]" item="price" type="text"  /></td>   
       <td class="tab-align-l" style="padding:0;"><input readonly name="width[]" item="width" type="text"  /></td>
       <td class="tab-align-l"><input name="fabric_characteristics[]" item="fabric_characteristics" type="text"  /></td>
       <td class="tab-align-l">
       <a item="picture_show" cid=""  style="display:none;" href="javascript:;">查看</a></td>
       <td class="tab-align-l"><input type="button" item="op" class="btn-2"  value="添加"  /></td>
       </tr>
      <!--{foreach from=$fabric_info_list item=fabric_info name=fi}-->
       <tr class="fabric_info_list">
       <td class="tab-align-l">
       <input name="fabric_info_id[]" type="hidden" value="{$fabric_info.fabric_info_id}" />
           <input name="cc_id[]" item="cc_id" type="hidden" value="{$fabric_info.cc_id}" />
       <input name="description[]" item="description" type="hidden"  value="{$fabric_info.description|escape}" />{$fabric_info.description|escape}</td>
       <td class="tab-align-l">
       <input name="fabric_shop_name[]" item="fabric_shop_name" type="hidden"  value="{$fabric_info.fabric_shop_id}" />
{$fabric_info.fabric_shop_name}</td>    
       <td class="tab-align-l">
       <input name="item[]" item="item" type="hidden"  value="{$fabric_info.item}" />
{$fabric_info.item}
</td>
       <td class="tab-align-l">
       <input name="price[]" item="price" type="hidden"  value="{$fabric_info.price}" />
 {$fabric_info.price}</td>   
       <td class="tab-align-l">
        <input name="width[]" item="width" type="hidden"  value="{$fabric_info.width}" />
{$fabric_info.width}</td>
       <td class="tab-align-l"><input name="fabric_characteristics[]" item="fabric_characteristics" type="hidden"  value="{$fabric_info.fabric_characteristics}" />
{$fabric_info.fabric_characteristics}</td>
       <td class="tab-align-l">
      <a  item="picture_show" cid="{$fabric_info.cc_id}"  href="javascript:;">查看</a>
</td>
      <td class="tab-align-l"><input type="button" item="op" value="移除" onClick="remove_fabric_shop(this);"  /></td>

       </tr>
       <!--{/foreach}-->
  
       </table>
       </td>
      </tr>
	
			<tr>
            <th class="align_right" colspan="1">批办意见:</th>
				<td colspan="7" align="left">
				<textarea style="width:90%; height:120px;" id="opinion" name="opinion">{$ss_info.opinion}</textarea>
				</td>
			</tr>
            <th class="align_right" colspan="1" >尺寸表:<br />
（<a href="{url app=style&act=edit_size&sid=$order.style_id}" target="_blank">款式匹配尺寸管理</a>）</th>
				<td colspan="7" class="tab-align-l">
					<table align="left" cellpadding="0" cellspacing="0" class="tab-add" id="tab-color1">
                  <tr><th colspan="9"><input type="button" onClick="add_style_size(this);" item="op" class="btn-2" value="增加一行"  style="float:right;margin-right:10px;"/> </th></tr>
                  
		           <th width="">部位尺寸</th>
			       <th width="10%">尺码1</th>
			       <th width="10%">尺码2</th>
			       <th width="10%">尺码3</th>
			       <th width="10%">尺码4</th>
			       <th width="10%">尺码5</th>
			       <th width="10%">尺码6</th>
			       <th width="10%">跳码 CM/码</th>
                   <th width="8%">{$lang.handle}</th>
                   
                    <tr id="one_size" style="display:none;">
        <td><input type="text" name="position[]" value="" class="input-5"></td>
        <td><input onBlur="javascript:change_size(this);" type="text" name="w6[]" value="" class="input-5"></td>
        <td><input onBlur="javascript:change_size(this);" type="text" name="w8[]" value="" class="input-5"></td>
        <td><input onBlur="javascript:change_size(this);" type="text" name="w10[]" value="" class="input-5"></td>
        <td><input onBlur="javascript:change_size(this);" type="text" name="w12[]" value="" class="input-5"></td>
        <td><input onBlur="javascript:change_size(this);" type="text" name="w14[]" value="" class="input-5"></td>
        <td><input onBlur="javascript:change_size(this);" type="text" name="w16[]" value="" class="input-5"></td>
        <td><input onBlur="javascript:change_size(this);" type="text" name="code[]" value="" class="input-5"></td>
        <td><input type="button" item="op" class="btn-2" value="删除" onClick="remove_style_size(this);" /></td>
      </tr>
        <tr>
			       <!--{foreach from=$size_ss_info item=s name=n}-->
			       <tr>
			       <td><input value="{$s.position}" type="text" name="position[]" class="input-5" /></td>
			       <td><input onblur="javascript:change_size(this);" value="{$s.w6}" type="text" name="w6[]" class="input-5" /></td>
			       <td><input onblur="javascript:change_size(this);" value="{$s.w8}" type="text" name="w8[]" class="input-5" /></td>
			       <td><input onblur="javascript:change_size(this);" value="{$s.w10}" type="text" name="w10[]" class="input-5" /></td>
			       <td><input onblur="javascript:change_size(this);" value="{$s.w12}" type="text" name="w12[]" class="input-5" /></td>
			       <td><input onblur="javascript:change_size(this);" value="{$s.w14}" type="text" name="w14[]" class="input-5" /></td>
			       <td><input onblur="javascript:change_size(this);" value="{$s.w16}" type="text" name="w16[]" class="input-5" /></td>
			       <td><input onblur="javascript:change_size(this);" value="{$s.code}" type="text" name="code[]" class="input-5" /></td>
                   <td><input type="button" item="op" class="btn-2" value="删除" onClick="remove_style_size(this);" /></td>
			       </tr>
                   
			       <!-- {/foreach} -->
		            </table>
	            </td>
            </tr>
            <tr>
				<th colspan="8"><input class="btn-2" type="submit" value="生成制单" />
               </th>
			</tr>
		</table>
		</form>
	</div>
</div>
<script language="JavaScript" type="text/javascript" src="{res file=js/tab_color.js}"></script>
</body>
</html>